import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter)

const routes = [
    {
        path:'/',
        name:'Home',
        component:()=>import('../views/Home.vue')
    },
    {
        path:'/MyTeam',
        name:'MyTeam',
        component:()=>import('../views/MyTeam.vue'),
    },
    {
        path:'/MyAbout',
        name:'MyAbout',
        component:()=>import('../views/MyAbout.vue'),
    },
    //企业
    {
        path:'/Company',
        name:'Company',
        component:()=>import('../views/Company.vue'),
        children:[
            {   //发布招聘
                path:'/publishRecruitment',
                name:'publishRecruitment',
                component:()=>import('../views/publishRecruitment')
            },
            {   //已有招聘信息
                path:'/existingRecruitment',
                name:'existingRecruitment',
                component:()=>import('../views/existingRecruitment'),
                children:[]
            },
            {   //查看收到的简历
                path:'/ViewResume',
                name:'ViewResume',
                component:()=>import('../views/ViewResume')
            },
            {   //简历详情
                path:'/ResumeDetail',
                name:'ResumeDetail',
                component:()=>import('../views/ResumeDetail')
            }
        ] 
    },
    //个人
    {
        path:'/Personal',
        name:'Personal',
        component:()=>import('../views/Personal.vue'),
        children:[
            {
                //招聘信息
                path:'/PersonalRInfo',
                name:'PersonalRInfo',
                component:()=>import('../views/PersonalRInfo')
            },
            {  
                //个人简历
                path:'/PersonalResume',
                name:'PersonalResume',
                component:()=>import('../views/PersonalResume'),
                children:[]
            },
            {   
                //编写个人资料
                path:'/PersonalGetResume',
                name:'PersonalGetResume',
                component:()=>import('../views/PersonalGetResume'),
                children:[]
            },
            {
                //实习经历
                path:'/PerPracticejob',
                name:'PerPracticejob',
                component:()=>import('../views/PerPracticejob'),
                children:[]
            },
            {
                //项目经历
                path:'/PerProjectexp',
                name:'PerProjectexp',
                component:()=>import('../views/PerProjectexp'),
                children:[]
            },
        ] 
    },
]

const router = new VueRouter({

    mode: 'hash',
    routes
})


// router.beforeEach((to, from, next) => {
//     const token = localStorage.setItem('token')
//     if (!token)next({name:''})
//     else next()
// });

export default router
//解决路由冗余
const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


